package com.alks.yn_zs.controller;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.page.PageRecord;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.yn_zs.data.dto.HistDto;
import com.alks.yn_zs.data.dto.MtlInDto;
import com.alks.yn_zs.data.dto.StatsDto;
import com.alks.yn_zs.data.request.MtlInRequest;
import com.alks.yn_zs.data.request.StatsRequest;
import com.alks.yn_zs.service.IMtlShowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

/**
 * @author MS
 * @since 2024/11/12上午9:48
 */
@RestController
@ApiRestController("/show/mtl")
@Api(value = "材料", tags = "原材料仓看板")
@Slf4j
public class MtlShowController {
    @Autowired
    private IMtlShowService service;

    @WebLogger
    @PostMapping("/mtlIn/det")
    @ApiOperation(value = "入库明细", tags = "原材料仓看板")
    public ResponseInfo mtlInDet(@RequestBody MtlInRequest request) {
        PageRecord<MtlInDto> record = service.mtlInDet(request);
        return ResponseInfo.ok(record);
    }

    @WebLogger
    @PostMapping("/mtlStk/det")
    @ApiOperation(value = "库存明细", tags = "原材料仓看板")
    public ResponseInfo mtlStkDet(@RequestBody MtlInRequest request) {
        PageRecord<MtlInDto> record = service.mtlStkDet(request);
        return ResponseInfo.ok(record);
    }

    @WebLogger
    @PostMapping("/io/status")
    @ApiOperation(value = "出入库统计", tags = "原材料仓看板")
    public ResponseInfo mtlIoStq(@RequestBody StatsRequest request) {
        List<StatsDto> dtoList = service.mtlIoStq(request);
        return ResponseInfo.ok(dtoList);
    }

}